home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
gawk
/
cawf2st.zoo
/
store.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-12
|
10KB
|
177 lines
/*
* store.c - cawf(1) storage areas
*/
/*
* Copyright (c) 1991 Purdue University Research Foundation,
* West Lafayette, Indiana 47907. All rights reserved.
*
* Written by Victor A. Abell <abe@mace.cc.purdue.edu>, Purdue
* University Computing Center. Not derived from licensed software;
* derived from awf(1) by Henry Spencer of the University of Toronto.
*
* Permission is granted to anyone to use this software for any
* purpose on any computer system, and to alter it and redistribute
* it freely, subject to the following restrictions:
*
* 1. The author is not responsible for any consequences of use of
* this software, even if they arise from flaws in it.
*
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission. Credits must appear in the
* documentation.
*
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software. Credits must
* appear in the documentation.
*
* 4. This notice may not be removed or altered.
*/
#include "cawf.h"
struct rx Pat[] = {
{ "^\\.(i[ef]|el)", NULL}, /* 0 */
{ "^\\.i[ef] !", NULL}, /* 1 */
{ "^\\.i[ef] !?\\\\n\\(\\.\\$[<=>][0-9] ", NULL}, /* 2 */
{ "^\\.i[ef] !?'\\\\\\$[0-9]'[^']*' ", NULL}, /* 3 */
{ "^\\.i[ef] !?[nt] ", NULL}, /* 4 */
{ "\\\\\\$[0-9]", NULL}, /* 5 */
{ "^[ \t]*$", NULL}, /* 6 */
{ "\\\\|\t|-| ", NULL}, /* 7 */
{ "[.!?:][]\\)'\\\"\\*]*$", NULL}, /* 8 */
{ ",fP", NULL}, /* 9 */
{ ",tP", NULL}, /* 10 */
{ "^(ta|ll|ls|in|ti|po|ne|sp|pl|nr)", NULL}, /* 11 */
{ "^(ll|ls|in|ti|po|pl)", NULL}, /* 12 */
{ "[]\\)'\\\"\\*]", NULL}, /* 13 */
{ "^(LH|CH|RH|LF|CF|RF)", NULL}, /* 14 */
{ "^\\.i[ef]", NULL}, /* 15 */
{ NULL, NULL} /* END */
};
int Adj = BOTHADJ; /* output line adjustment mode */
char *Aftnxt = NULL; /* action after next line */
char *Args[] = {NULL, NULL, /* 10 macro arguments */
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL};
char *Argstack[10*MAXSP]; /* stack for Expand()'s "args[]" */
int Backc = 0; /* last word ended with '\\c' */
int Botmarg = 5; /* bottom margin */
int Centering = 0; /* centering count */
int Condstack[MAXSP]; /* stack for Expand()'s "cond" */
char *Cont = NULL; /* continue line append */
int Contlen = 0; /* continue line append length */
int Curmx = -1; /* current macro index */
int Divert = 0; /* diversion status */
FILE *Efs = NULL; /* error file stream */
char *Eol = NULL; /* end of line information */
int Eollen = 0; /* end of line length */
int Err = 0; /* error flag */
char *F = NULL; /* field value */
struct fcode Fcode[] = { /* font codes */
{ 'B', '\0'}, /* Bold */
{ 'I', '\0'}, /* Italic */
{ 'R', '\0'}, /* Roman */
{ '\0', '\0'}
};
int Fill = 0; /* fill status */
char Font[] = { '\0', '\0' }; /* current font */
char Fontout = 'b'; /* font output mode: 'n' = none
* 'b' = BS & UL
* 'e' = ESC & code */
int Fph = 0; /* first page header status */
int Fsp = 0; /* files stack pointer (for .so) */
char *Ftc = NULL; /* center footer */
char *Ftl = NULL; /* left footer */
char *Ftr = NULL; /* right footer */
char *Hdc = NULL; /* center header */
int Hdft = 0; /* header/footer status */
char *Hdl = NULL; /* left header */
char *Hdr = NULL; /* right header */
struct hytab Hychar[MAXHYCH]; /* hyphen characters */
FILE *Ifs = NULL; /* input file stream */
FILE *Ifs_stk[MAXFSTK]; /* Ifs stack */
int Ind = 0; /* indentation amount */
char *Inname = NULL; /* input file name */
char *Inn_stk[MAXFSTK]; /* Inname stack */
int LL = 78; /* line length (default) */
char Line[MAXLINE]; /* input line */
int Lockil = 0; /* pass 2 line number is locked
* (processing is inside macro) */
int Marg = 0; /* macro argument - man, ms, etc. */
struct macro Macrotab[MAXMACRO]; /* macro table */
char *Macrotxt[MAXMTXT]; /* macro text */
int Mtx = 0; /* macro text index */
int Mxstack[MAXSP]; /* stack for Expand()'s "mx" */
int Nfc; /* number of font codes */
int Nhnr[MAXNHNR]; /* ".NH" numbers */
int Nhy = 0; /* number of Hychar[] entries */
int Nleftstack[MAXSP]; /* stack for Expand()'s "nleft" */
int Nmac = 0; /* number of macros */
int Nnr = 0; /* number of Numb[] entries */
int Nospmode = 1; /* no space mode */
int Nparms = 0; /* number of Parms[] entries */
int NR = 0; /* number of record ala awk */
int NR_stk[MAXFSTK]; /* NR stack */
int Nsch = 0; /* number of Schar[] entries */
int Nstr = 0; /* number of entries in Str[] */
int Ntabs = 0; /* number of TAB positions */
struct nbr Numb[MAXNR]; /* number registers */
int Nxtln = 1; /* next line number */
int Outll = -1; /* output line length */
char Outln[MAXOLL*2]; /* output line */
int Outlx = 0; /* output line index */
int P2il = 0; /* pass 2 input line number */
char *P2name = NULL; /* pass 2 input file name */
int P3fill = 1; /* pass 3 fill status */
int Padchar[MAXOLL]; /* padding character locations */
int Padfrom = PADLEFT; /* which end to pad from */
int Padx = 0; /* Padchar[] index */
struct parms Parms[] = { /* parameter registers */
{ {'i', 'n'}, "indent", 0, 0 },
{ {'l', 'l'}, "linelen", 0, 0 },
{ {'l', 's'}, "vspace", 0, 0 },
{ {'t', 'i'}, "tempindent", 0, 0 },
{ {'p', 'o'}, "pageoffset", 0, 0 },
{ {'p', 'l'}, "pagelen", 0, 0 },
{ {'\0', '\0'}, NULL, 0, 0 }
};
char Pass1ln[MAXLINE]; /* pass 1 output line */
char Pass2ln[MAXLINE]; /* pass 2 output line */
int Pglen = 66; /* page length */
int Pgoff = 0; /* page offset */
char *Pname = NULL; /* program name */
char Prevfont = '\0'; /* previous font */
int Ptrstack[MAXSP];